<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul li:nth-of-type(odd) {
            background: palegreen;
            /* 奇数 */
        }
        
        ul li:nth-of-type(even) {
            background-color: paleturquoise;
            /* 偶数 */
        }
    </style>
</head>

<body>
    <ul>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>
        <li>nihao</li>

    </ul>
</body>

</html>